﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace WordWonderGame.UI.Man3
{
    public partial class ChonDA : UserControl
    {
        public event EventHandler ClickChonDA;
        public event EventHandler ClickHuyDA;
        public bool AllowChonDapAn { get; set; }
        public string Tu
        {
            get
            {
                return lbTu.Text;
            }
            set
            {
                lbTu.Text = value;
                BackgroundImage = imageList1.Images[0];
                this.lbTu.ForeColor = System.Drawing.Color.Blue;
                selected = false;
            }
        }
        bool selected = false;

        public ChonDA()
        {
            InitializeComponent();
        }

        private void ChonDA_Click(object sender, EventArgs e)
        {
            if (AllowChonDapAn)
            {
                selected = !selected;
                if (selected)
                {
                    if (ClickChonDA != null)
                    {
                        ClickChonDA(Tu, null);
                    }
                    BackgroundImage = imageList1.Images[1];
                    this.lbTu.ForeColor = System.Drawing.Color.Yellow;

                }
                else
                {
                    if (ClickHuyDA != null)
                    {

                        ClickHuyDA(Tu, null);
                    }
                    BackgroundImage = imageList1.Images[0];
                    this.lbTu.ForeColor = System.Drawing.Color.Blue;
                }
            }
        }

        private void lbTu_Click(object sender, EventArgs e)
        {
            if (AllowChonDapAn)
            {
                selected = !selected;
                if (selected)
                {
                    if (ClickChonDA != null)
                    {
                        ClickChonDA(Tu, null);
                    }
                    BackgroundImage = imageList1.Images[1];
                    this.lbTu.ForeColor = System.Drawing.Color.Yellow;
                }

                else
                {
                    if (ClickHuyDA != null)
                    {
                        ClickHuyDA(Tu, null);
                    }
                    BackgroundImage = imageList1.Images[0];
                    this.lbTu.ForeColor = System.Drawing.Color.Blue;
                }
            }
        }





    }
}
